using System;
using System.Collections.Generic;
using System.Text;

namespace Comteck.Dto.Common {
  public static class NumberExtensions {
    /// <summary>
    /// 获取数字固定长度字符串，长度不足在前面补0，长度为19
    /// </summary>
    /// <param name="value"></param>
    /// <returns></returns>
    public static string ToFixedString(this long value) => value.ToString("D19");
    /// <summary>
    /// 获取数字固定长度字符串，长度不足在前面补0，长度为20
    /// </summary>
    /// <param name="value"></param>
    /// <returns></returns>
    public static string ToFixedString(this ulong value) => value.ToString("D20");
    /// <summary>
    /// 获取数字固定长度字符串，长度不足在前面补0，长度为10
    /// </summary>
    /// <param name="value"></param>
    /// <returns></returns>
    public static string ToFixedString(this int value) => value.ToString("D10");
    /// <summary>
    /// 获取数字固定长度字符串，长度不足在前面补0，长度为10
    /// </summary>
    /// <param name="value"></param>
    /// <returns></returns>
    public static string ToFixedString(this uint value) => value.ToString("D10");
    /// <summary>
    /// 获取数字固定长度字符串，长度不足在前面补0，长度为5
    /// </summary>
    /// <param name="value"></param>
    /// <returns></returns>
    public static string ToFixedString(this short value) => value.ToString("D5");
    /// <summary>
    /// 获取数字固定长度字符串，长度不足在前面补0，长度为5
    /// </summary>
    /// <param name="value"></param>
    /// <returns></returns>
    public static string ToFixedString(this ushort value) => value.ToString("D5");
    /// <summary>
    /// 获取数字固定长度字符串，长度不足在前面补0，长度为3
    /// </summary>
    /// <param name="value"></param>
    /// <returns></returns>
    public static string ToFixedString(this sbyte value) => value.ToString("D3");
    /// <summary>
    /// 获取数字固定长度字符串，长度不足在前面补0，长度为3
    /// </summary>
    /// <param name="value"></param>
    /// <returns></returns>
    public static string ToFixedString(this byte value) => value.ToString("D3");
  }
}
